<template>
<div>
    <el-form :model="inputForm" ref="inputForm" v-loading="loading"   :disabled="formReadOnly"
             label-width="120px">
      <el-row  :gutter="15">
        <el-col :span="24">
            <el-form-item label="工单号" prop="workOrderNumber"
                :rules="[
                 ]">
              <el-input v-model="inputForm.workOrderNumber" placeholder="请填写工单号"    disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="设备编码" prop="equipmentCode"
                :rules="[
                 ]">
              <el-input v-model="inputForm.equipmentCode" placeholder="请填写设备编码"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="厂" prop="factory"
                :rules="[
                 ]">
              <el-input v-model="inputForm.factory" placeholder="请填写厂"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="区域" prop="area"
                :rules="[
                 ]">
              <el-input v-model="inputForm.area" placeholder="请填写区域"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="主体设备" prop="mainEquipment"
                :rules="[
                 ]">
              <el-input v-model="inputForm.mainEquipment" placeholder="请填写主体设备"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="任务来源" prop="taskSource"
                :rules="[
                 ]">
              <el-input v-model="inputForm.taskSource" placeholder="请填写任务来源"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="施工内容" prop="roadworkContent"
                :rules="[
                 ]">
              <el-input v-model="inputForm.roadworkContent" placeholder="请填写施工内容"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="完成时间" prop="completeTime"
                :rules="[
                 ]">
              <el-input v-model="inputForm.completeTime" placeholder="请填写完成时间"     disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="接办人" prop="unsuccessfulPeople"
                :rules="[
                 ]">
                <user-select :limit='1' :value="inputForm.unsuccessfulPeople" @getValue='(value) => {inputForm.unsuccessfulPeople=value}' disabled=""></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="工号" prop="workNumber"
                :rules="[
                 ]">
              <el-input v-model="inputForm.workNumber" placeholder="请填写工号"   disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
                    <el-form-item label="计划工时" prop="overhaulPeople"
                        :rules="[
                         ]">
                      <el-input v-model="inputForm.overhaulPeople" placeholder="请填写计划工时" disabled=""></el-input>
                   </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="计划检修人数" prop="repirpeople"
                        :rules="[
                         ]">
                      <el-input v-model="inputForm.repirpeople" placeholder="请填写计划检修人数" disabled=""></el-input>
                   </el-form-item>
                </el-col>
        <el-col :span="24">
            <el-form-item label="实际工时" prop="workTime"
                :rules="[
                 ]">
              <el-input v-model="inputForm.workTime" placeholder="请填写实际工时"     ></el-input>
           </el-form-item>
        </el-col>
        <!-- <el-col :span="24">
            <el-form-item label="状态" prop="state"
                :rules="[
                 ]">
                 <el-select v-model="inputForm.state" placeholder="请填状态" style="width:100%;" >
              <el-option v-for="state in $dictUtils.getDictList('repair_statement')" :label="state.label" :value="state.value" :key="state.value"></el-option>
              </el-select>
           </el-form-item>
        </el-col> -->
        <el-col :span="24">
            <el-form-item label="实际人数" prop="projectMan"
                :rules="[
                 ]">
              <user-select :limit='10' :value="inputForm.projectMan" @getValue='(value) => {inputForm.projectMan=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修区域班长" prop="repairAreaMonitor"
                :rules="[
                 ]" v-show="start">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairAreaMonitor" @getValue='(value) => {inputForm.repairAreaMonitor=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="设备厂长" prop="repairWorkLong"
                :rules="[
                 ]" v-show="isWorkLong">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairWorkLong" @getValue='(value) => {inputForm.repairWorkLong=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修工程师" prop="repairEngineer"
                :rules="[
                 ]" v-show="start">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairEngineer" @getValue='(value) => {inputForm.repairEngineer=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="区域安全员" prop="repairAreaHon"
                :rules="[
                 ]" v-show="isAreaHon">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairAreaHon" @getValue='(value) => {inputForm.repairAreaHon=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="项目负责人" prop="repairProjectHead"
                :rules="[
                 ]" v-show="start">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairProjectHead" @getValue='(value) => {inputForm.repairProjectHead=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="点检员" prop="repairCheckOne"
                :rules="[
                 ]" v-show="start">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairCheckOne" @getValue='(value) => {inputForm.repairCheckOne=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
            <el-form-item label="选择点检员" prop="repairCheckTwo"
                :rules="[
                 ]">
              <user-select :limit='1' :value="inputForm.repairCheckTwo" @getValue='(value) => {inputForm.repairCheckTwo=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col> -->
        <el-col :span="24">
            <el-form-item label="检修人员" prop="repairPeople"
                :rules="[
                 ]" v-show="isThreeAccept">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairPeople" @getValue='(value) => {inputForm.repairPeople=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="生产岗位人员" prop="repairProduction"
                :rules="[
                 ]" v-show="isThreeAccept">
              <!-- <el-input v-model="inputForm.unsuccessfulPeople" placeholder="请填写接办人" disabled=""></el-input> -->
              <user-select :limit='1' :value="inputForm.repairProduction" @getValue='(value) => {inputForm.repairProduction=value}' @getUserName='getUserName(arguments)'></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="施工方案" prop="repairMake"
                :rules="[
                 ]" v-show="isRepairMake">
              <el-upload ref="repairMake"
                    :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/flowform/form/repairMake`"
                    :headers="{token: $cookie.get('token')}"
                    :on-preview="(file, fileList) => {$window.location.href = (file.response && file.response.url) || file.url}"
                    :on-success="(response, file, fileList) => {
                       inputForm.repairMake = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                    }"
                    :on-remove="(file, fileList) => {
                      $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                        $message.success(data.msg)
                      })
                      inputForm.repairMake = fileList.map(item => item.url).join('|')
                    }"
                    :before-remove="(file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`)
                    }"
                    multiple
                    :limit="5"
                    :on-exceed="(files, fileList) =>{
                      $message.warning(`当前限制选择 5 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
                    }"
                    :file-list="repairMakeArra" disabled="">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">添加相关附件</div>
                  </el-upload>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修上传人" prop="makePeople"
                :rules="[
                 ]" v-show="isRepairMake">
              <!-- <el-input v-model="inputForm.makePeople" placeholder="请填写上传人"     ></el-input> -->
              <user-select :limit='1' :value="inputForm.makePeople" @getValue='(value) => {inputForm.makePeople=value}' @getUserName='getUserName(arguments)' disabled></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修上传时间" prop="repairMakeTime"
                :rules="[
                 ]" v-show="isRepairMake">
              <!-- <el-input v-model="inputForm.repairMakeTime" placeholder="请填写上传时间"     ></el-input> -->
              <el-date-picker
                    style="width:100%;"
                    v-model="inputForm.repairMakeTime"
                    type="datetime"
                    placeholder="选择日期时间"
                    default-time="12:00:00" disabled="">
              </el-date-picker>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="安全措施" prop="uploadPeople"
                :rules="[
                 ]" v-show="isRepairSafeMake">
              <el-upload ref="uploadPeople"
                    :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/flowform/form/repairMakeSafe`"
                    :headers="{token: $cookie.get('token')}"
                    :on-preview="(file, fileList) => {$window.location.href = (file.response && file.response.url) || file.url}"
                    :on-success="(response, file, fileList) => {
                       inputForm.uploadPeople = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                    }"
                    :on-remove="(file, fileList) => {
                      $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                        $message.success(data.msg)
                      })
                      inputForm.uploadPeople = fileList.map(item => item.url).join('|')
                    }"
                    :before-remove="(file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`)
                    }"
                    multiple
                    :limit="5"
                    :on-exceed="(files, fileList) =>{
                      $message.warning(`当前限制选择 5 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
                    }"
                    :file-list="uploadPeopleArra" disabled="">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">添加相关附件</div>
                  </el-upload>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="安全措施上传人" prop="makeSafePeople"
                :rules="[
                 ]" v-show="isRepairSafeMake">
              <!-- <el-input v-model="inputForm.repairMakeSafe" placeholder="请填写安全措施"     ></el-input> -->
              <user-select :limit='1' :value="inputForm.makeSafePeople" @getValue='(value) => {inputForm.repairMakeSafe=value}' @getUserName='getUserName(arguments)' disabled></user-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="安全措施上传时间" prop="repairMakeSafeTime"
                :rules="[
                 ]" v-show="isRepairSafeMake">
              <!-- <el-input v-model="inputForm.repairMakeTime" placeholder="请填写上传时间"     ></el-input> -->
              <el-date-picker
                    style="width:100%;"
                    v-model="inputForm.repairMakeSafeTime"
                    type="datetime"
                    placeholder="选择日期时间"
                    default-time="12:00:00" disabled="">
              </el-date-picker >
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="必要性描述" prop="repairDescribe"
                :rules="[
                 ]" v-show="isTool">
              <el-input v-model="inputForm.repairDescribe" placeholder="请填写必要性描述"  disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="机具名称" prop="repairName"
                :rules="[
                 ]" v-show="isTool">
              <el-input v-model="inputForm.repairName" placeholder="请填写机具名称"  disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="机具型号" prop="repairType"
                :rules="[
                 ]" v-show="isTool">
              <el-input v-model="inputForm.repairType" placeholder="请填写型号" disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="机具数量" prop="repairAmount"
                :rules="[
                 ]" v-show="isTool">
              <el-input v-model="inputForm.repairAmount" placeholder="请填写数量" disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修项目开始时间" prop="startTime"
                :rules="[
                 ]" v-show="isPerform">
              <!-- <el-input v-model="inputForm.completeTime" placeholder="请填写完成时间" ></el-input> -->
              <el-date-picker
                    style="width:100%;"
                    v-model="inputForm.startTime"
                    type="datetime"
                    placeholder="选择日期时间"
                    default-time="12:00:00" disabled="">
              </el-date-picker>
              </el-form-item>
              </el-col>
        <el-col :span="24">
            <el-form-item label="实际完成时间" prop="actualCompleteTime"
                :rules="[
                 ]" v-show="isPerform">
              <el-input v-model="inputForm.actualCompleteTime" placeholder="请填写实际完成时间" disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="完成情况" prop="completeSituation"
                :rules="[
                 ]" v-show="isPerform">
              <el-input v-model="inputForm.completeSituation" placeholder="请填写完成情况" disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="有无异常" prop="isAbnormal"
                :rules="[
                 ]" v-show="isPerform">
              <el-input v-model="inputForm.isAbnormal" placeholder="请填写有无异常" disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="点检意见" prop="tallyOpinion"
                :rules="[
                 ]" v-show="isAccept">
              <!-- <el-input v-model="inputForm.tallyOpinion" placeholder="请填写点检意见"   ></el-input> -->
              <el-select v-model="inputForm.tallyOpinion" placeholder="请选择"  style="width: 100%;" disabled="">
                        <el-option
                          v-for="item in $dictUtils.getDictList('repair_opinion')"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                        </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修意见" prop="maintenanceOpinion"
                :rules="[
                 ]" v-show="isAccept">
              <el-select v-model="inputForm.maintenanceOpinion" placeholder="请选择"  style="width: 100%;" disabled="">
                        <el-option
                          v-for="item in $dictUtils.getDictList('repair_opinion')"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                        </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="生产意见" prop="productionOpinion"
                :rules="[
                 ]" v-show="isAccept">
             <el-select v-model="inputForm.productionOpinion" placeholder="请选择"  style="width: 100%;" disabled="">
                       <el-option
                         v-for="item in $dictUtils.getDictList('repair_opinion')"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value">
                       </el-option>
                       </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="点检意见说明" prop="remark"
                :rules="[
                 ]" v-show="isAccept">
              <el-input  type="textarea" v-model="inputForm.remark" placeholder="请填写意见说明"  disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="检修意见说明" prop="checkRemark"
                :rules="[
                 ]" v-show="isAccept">
              <el-input type="textarea" v-model="inputForm.checkRemark" placeholder="请填写意见说明"  disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="生产意见说明" prop="productRemark"
                :rules="[
                 ]" v-show="isAccept">
              <el-input  type="textarea" v-model="inputForm.productRemark" placeholder="请填写意见说明"  disabled=""></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
         <el-form-item label-width="0">
                <el-tabs v-model="repairPlanTab">
      <el-tab-pane label="材料准备附表" v-if="isMeterial">
            <el-table
            border
            :data="outThePutForm.repairPlanPttachList.filter(function(item){ return item.delFlag !== '1'})"
            style="width: 100%">
          <el-table-column
              prop="repairType"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="规格型号">
            </el-table-column>
          <el-table-column
              prop="repairUnit"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="单位">
            </el-table-column>
          <el-table-column
              prop="repairAmount"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="数量">
            </el-table-column>
          <el-table-column
              prop="repairSymbol"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="单价">
            </el-table-column>
          <el-table-column
              prop="repairSum"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="金额">
            </el-table-column>
          <el-table-column
              prop="repairTime"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="要求使用时间">
            </el-table-column>
          <el-table-column
              prop="remarks"
              header-align="center"
              align="center"
              show-overflow-tooltip
              label="备注信息">
            </el-table-column>
            <el-table-column
              fixed="right"
              label="操作"
              width="150">
              <template slot-scope="scope">
                <el-button @click="viewRepairPlanPttachRow(scope.row)" type="text" size="small">查看</el-button>
              </template>
            </el-table-column>
            </el-table>
                </el-tab-pane>
              </el-tabs>
             </el-form-item>
            </el-col>
        </el-row>
    </el-form>
    <RepairPlanPttachForm ref="repairPlanPttachForm"  ></RepairPlanPttachForm>
</div>
</template>

<script>
  import UserSelect from '@/components/userSelect'
  import RepairPlanPttachForm from '../form/RepairPlanPttachForm'
  export default {
    data () {
      return {
        title: '',
        method: '',
        loading: false,
        repairMakeArra: [],
        uploadPeopleArra: [],
        repairPlanTab: '0',
        inputForm: {
          id: '',
          repairPlanPttachList: [],
          workOrderNumber: this.outPutForm.workOrderNumber,
          equipmentCode: this.outPutForm.equipmentCode,
          factory: this.outPutForm.factory,
          area: this.outPutForm.area,
          mainEquipment: this.outPutForm.mainEquipment,
          taskSource: this.outPutForm.taskSource,
          roadworkContent: this.outPutForm.roadworkContent,
          completeTime: this.outPutForm.completeTime,
          unsuccessfulPeople: this.outPutForm.unsuccessfulPeople,
          workNumber: this.outPutForm.workNumber,
          repairAreaMonitor: '',
          repairWorkLong: '',
          repairEngineer: '',
          repairAreaHon: '',
          repairProjectHead: '',
          repairCheckOne: '',
          repairCheckTwo: '',
          repairPeople: '',
          repairProduction: '',
          workTime: '',
          state: 0,
          projectMan: '',
          testId: this.outPutForm.testId,
          repirpeople: this.outPutForm.repirpeople,
          overhaulPeople: this.outPutForm.overhaulPeople,
          repairMake: '',
          makePeople: '',
          repairMakeTime: '',
          uploadPeople: '',
          repairMakeSafe: '',
          repairMakeSafeTime: '',
          repairDescribe: '',
          repairName: '',
          repairType: '',
          repairAmount: '',
          startTime: '',
          actualCompleteTime: '',
          completeSituation: '',
          isAbnormal: '',
          tallyOpinion: '',
          maintenanceOpinion: '',
          remark: '',
          checkRemark: '',
          productRemark: '',
          makeSafePeople: '',
          processId: ''
        },
        outThePutForm: {
          id: '',
          repairPlanPttachList: [],
          roadworkContent: '',
          unsuccessfulPeople: '',
          workNumber: '',
          workTime: '',
          state: '',
          projectMan: '',
          remarks: '',
          testId: '',
          checkTime: '',
          checkPeopleNumber: '',
          repirpeople: '',
          overhaulPeople: ''
        },
        titleName: '',
        materialCode: '',
        start: false,
        isWorkLong: false,
        isAreaHon: false,
        isThreeAccept: false,
        isRepairMake: false,
        isRepairSafeMake: false,
        isTool: false,
        isPerform: false,
        isAccept: false,
        isMeterial: false
        }
    },
    props: {
      businessId: {
        type: String,
        default: ''
      },
      formReadOnly: {
        type: Boolean,
        default: false
      },
      thetitle: '',
      outPutForm: {
        // id: '',
        workOrderNumber: '',
        equipmentCode: '',
        factory: '',
        area: '',
        mainEquipment: '',
        taskSource: '',
        roadworkContent: '',
        completeTime: '',
        unsuccessfulPeople: '',
        workNumber: '',
        testId: '',
        repirpeople: '',
        overhaulPeople: ''
      }
    },
    components: {
      UserSelect,
      RepairPlanPttachForm
    },
    watch: {
      //刘明星人员判断传值
      'thetitle': {
        handler (newVal) {
          this.titleName = newVal
          if (newVal === '发起流程【检修流程】') {
            this.start = true
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = false
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【检修区域班长制定施工方案】') {
            this.start = false
            this.isWorkLong = true
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = true
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【设备厂长审核施工方案】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = true
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【检修项目负责人制定安全措施】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = true
            this.isThreeAccept = false
            this.isRepairMake = false
            this.isRepairSafeMake = true
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【区域安全员审核安全措施】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = false
            this.isRepairSafeMake = true
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【检修机具由项目负责人负责流程】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = false
            this.isRepairSafeMake = false
            this.isTool = true
            this.isPerform = false
            this.isAccept = false
          } else if (newVal === '审批【项目负责人流程】' || newVal === '审批【检修作业长查看所完成检修并填报完成情况】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = true
            this.isRepairMake = false
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = true
            this.isAccept = false
          } else if (newVal === '审批【点检员验收审核】' || newVal === '审批【检修员验收审核】' || newVal === '审批【生产岗位人员验收审核】' || newVal === '审批【检修作业长查看】') {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = true
            this.isRepairMake = false
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = false
            this.isAccept = true
          } else {
            this.start = false
            this.isWorkLong = false
            this.isAreaHon = false
            this.isThreeAccept = false
            this.isRepairMake = false
            this.isRepairSafeMake = false
            this.isTool = false
            this.isPerform = false
            this.isAccept = false
          }
        },
        immediate: true,
        deep: false
      },
      'inputForm.testId': {
         handler (newVal) {
           console.log(newVal)
           if (newVal !== undefined) {
           if (this.titleName === '审批【点检员准备材料】') {
             this.isMeterial = true
             this.outit(newVal)
           } else {
             this.isMeterial = false
           }
           }
             this.$emit('testIds', newVal)
         },
         immediate: true,
         deep: false
      },
      'inputForm.workTime': function (newVal, oldVal) {
          this.$emit('workTimes', newVal)
      },
      'inputForm.projectMan': function (newVal, oldVal) {
        this.$emit('projectMans', newVal)
      },
      'businessId': {
        handler (newVal) {
          if (this.businessId) {
            this.init(this.businessId)
          } else {
            this.$nextTick(() => {
              this.$refs.inputForm.resetFields()
              console.log(this.businessId)
            })
          }
        },
        immediate: true,
        deep: false
      }
    },
    methods: {
      viewRepairPlanPttachRow (child) {
        this.$refs.repairPlanPttachForm.init('view', child)
      },
      outit (testId) {
        this.loading = true
        this.$nextTick(() => {
          this.repairPlanTab = '0'
          this.outThePutForm.repairPlanPttachList = []
            this.loading = true
            this.$http({
              url: `/flowform/form/repairPlan/getId`,
              method: 'get',
              params: {
                testId: testId
              }
            }).then(({data}) => {
              console.log(data.repairPlan)
              this.materialCode = data.repairPlan.id
               this.$http({
                 url: `/flowform/form/repairPlan/queryById?id=${this.materialCode}`,
                 method: 'get'
               }).then(({data}) => {
                 this.outThePutForm = this.recover(this.outThePutForm, data.repairPlan)
                 console.log(data)
                 this.loading = false
               })
            })
          })
      },
      init (id) {
        if (id) {
          this.loading = true
          this.inputForm.id = id
          this.repairMakeArra = []
          this.uploadPeopleArra = []
          this.$nextTick(() => {
            this.$refs.inputForm.resetFields()
            this.$http({
              url: `/flowform/process/repairTaskDistributionProcess/queryById?id=${this.inputForm.id}`,
              method: 'get'
            }).then(({data}) => {
              this.inputForm = this.recover(this.inputForm, data.repairTaskDistributionProcess)
              this.inputForm.repairMake.split('|').forEach((item) => {
                if (item.trim().length > 0) {
                  this.repairMakeArra.push({name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item})
                }
              })
              this.inputForm.uploadPeople.split('|').forEach((item) => {
                if (item.trim().length > 0) {
                  this.uploadPeopleArra.push({name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item})
                }
              })
              this.loading = false
            })
          })
        }
      },
      // 表单提交
      saveForm (callback) {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.loading = true
            this.$http({
              url: `/flowform/process/repairTaskDistributionProcess/save`,
              method: 'post',
              data: this.inputForm
            }).then(({data}) => {
              if (data && data.success) {
                callback(data.businessTable, data.businessId)
              }
            })
          }
        })
      }
    }
  }
</script>
